import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../views/Index.vue'
import About from '../views/About.vue'
import Story from '../views/Story.vue'
import Wode from '../views/Wode.vue'
import ZhaoFang from '../views/ZhaoFang.vue'
import Faxian from '../views/Faxian.vue'
import Storyplus from '../views/Storyplus.vue'
import Mapplus from '../views/Mapplus.vue'
import Detail from '../views/Detail.vue'
import Login from '../views/Login.vue'
import Register from '../views/Register.vue'
import Party from '../views/Party.vue'
import Ceshi from '../views/Ceshi.vue'
import Shoucang from '../views/Shoucang.vue'
import Notice from '../views/Notice.vue'
import Option from '../views/Option.vue'
import Mendian from '../views/Mendian.vue'
import Byplus from '../views/Byplus.vue'
import Communitys from '../views/Communitys.vue'
import Hx from '../views/Hx.vue'
import Ing from '../views/Ing.vue'
import Ingstory from '../views/Ingstory.vue'
import Md from '../views/Md.vue'
import Storys from '../views/Storys.vue'
import Others from '../views/Others.vue'
import Photo from '../views/Photo.vue'


Vue.use(VueRouter)
const routes = [
  {
    path: '/others',
    name: 'others',
    component: Others
  },
  {
    path: '/photo',
    name: 'photo',
    component: Photo
  },
  {
    path: '/storys',
    name: 'storys',
    component: Storys
  },
  {
    path: '/md',
    name: 'md',
    component: Md
  },
  {
    path: '/ingstory',
    name: 'ingstory',
    component: Ingstory
  },

  {
    path: '/ing',
    name: 'ing',
    component: Ing
  },
  {
    path: '/hx',
    name: 'hx',
    component: Hx
  },
  {
    path: '/communitys',
    name: 'communitys',
    component: Communitys
  },
  {
    path: '/byplus',
    name: 'byplus',
    component: Byplus
  },
  {
    path: '/wode',
    name: 'wode',
    component: Wode
  },
  {
    path: '/story',
    name: 'story',
    component: Story
  },
  {
    path: '/',
    name: 'index',
    component: Index
  },
  {
    path: '/zhaofang',
    name: 'zhaofang',
    component: ZhaoFang
  },
  {
    path: '/storyplus',
    name: 'storyplus',
    component: Storyplus
  },
  {
    path: '/faxian',
    name: 'faxian',
    component: Faxian
  },
  {
    path: '/mapplus',
    name: 'mapplus',
    component: Mapplus
  },
  {
    path: '/detail',
    name: 'detail',
    component: Detail
  },
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/register',
    name: 'register',
    component: Register
  },
  {
    path: '/party',
    name: 'party',
    component: Party
  },
  {
    path: '/ceshi',
    name: 'ceshi',
    component: Ceshi
  },
  {
    path: '/shoucang',
    name: 'shoucang',
    component: Shoucang
  },
  {
    path: '/notice',
    name: 'notice',
    component: Notice
  },
  {
    path: '/option',
    name: 'optiom',
    component: Option
  },
  {
    path: '/mendian',
    name: 'mendian',
    component: Mendian
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
  scrollBehavior(to, from, savedPosition) {
    //console.log(to,from,savedPosition,from.path=='/others');
    if (from.path == '/others') {
      // console.log('走默认高度')
      return savedPosition;
    } else {
      // console.log('置顶高度')
      return { x: 0, y: 0 }
    }
  },
})

export default router
